package string.nowcoder.easy;

import java.util.Scanner;

/**
 * @author Stark
 * @description 逆置字符串
 * 题目链接：https://www.nowcoder.com/practice/ee5de2e7c45a46a090c1ced2fdc62355?tpId=85&&tqId=29867&rp
 * =1&ru=/activity/oj&qru=/ta/2017test/question-ranking
 * @date 2022/4/18 21:14
 **/
public class ReverseString {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            String strInput = scanner.nextLine();
            //将字符串按空格拆分
            String[] strings = strInput.split(" ");
            StringBuilder sb = new StringBuilder();
            //反向拼接
            for (int i = strings.length - 1; i >= 0; i--) {
                sb.append(strings[i]);
                if(i != 0)
                    sb.append(" ");
            }
            System.out.println(sb.toString());
        }
    }
}
